<?php
/**
 * Joomla! 1.5 component wbdatabase
 *
 * @version $Id: view.html.php 2009-04-09 16:20:44 svn $
 * @author woomla
 * @package Joomla
 * @subpackage wbdatabase
 * @license GNU/GPL
 *
 * A personal database with some fields to remember logins and pin codes.
 *
 * This component file was created using the Joomla Component Creator by Not Web Design
 * http://www.notwebdesign.com/joomla_component_creator/
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

// Import Joomla! libraries
jimport( 'joomla.application.component.view');
class WbdatabasesViewWbdatabase extends JView 
{
  function display($tpl = null) 
  {
    //get the hello
    $item    =& $this->get('Data');
    $isNew   = ($item->id < 1);

    $text = $isNew ? JText::_( 'New' ) : JText::_( 'Edit' );
    JToolBarHelper::title(   JText::_( 'wbDatabase' ).': <small><small>[ ' . $text.' ]</small></small>' );
    JToolBarHelper::save();
    if ($isNew)  
    {
      JToolBarHelper::cancel();
    } 
    else 
    {
      // for existing items the button is renamed `close`
      JToolBarHelper::cancel('cancel', 'Close');
    }

    $this->assignRef('item', $item);

    $id      =& $this->get('Id');
    $this->assignRef('id', $id);

    $query      =& $this->get('query');
    $this->assignRef('query', $query);
    
    $description = & $this->get('description');
    $this->assignRef('description', $description);

    parent::display($tpl);
  }
  
  function rowInput($key, $value)
  {
    $result = '';
    $result .= '<tr>';
    $result .= '<td width="100" align="right" class="key">';
    $result .= '<label for="' . $key .'">';
    $result .= JText::_( $key );
    $result .= '</label>';
    $result .= '</td>';
    $result .= '<td>';
    $result .= '<input class="text_area" type="text" name="'.$key.'" id="'.$key.'" style="width:350px" maxlength="255" value="'.$value.'"/>';
    $result .= '</td>';
    $result .= '</tr>';
    return $result;
  }
  
  function rowText($key, $value)
  {
    $result = '';
    $result .= '<tr>';
    $result .= '<td width="100" align="right" class="key">';
    $result .= '<label for="' . $key .'">';
    $result .= JText::_( $key );
    $result .= '</label>';
    $result .= '</td>';
    $result .= '<td>';
    $result .= '<textarea class="text_area" type="text" name="'.$key.'" id="'.$key.'" rows="3" style="width:350px">'.$value.'</textarea>';
    $result .= '</td>';
    $result .= '</tr>';
    return $result;    
  }
}
?>